package com.community.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.community.dao.IBaseDao;
import com.community.entity.ArticleCommet;
import com.community.service.IArticleCommetService;

@Service
public class ArticleCommetServiceImpl implements IArticleCommetService{
	
	@Autowired
	private IBaseDao<ArticleCommet> amdao;

	@Override
	public List<ArticleCommet> getArticleCommetListByArticleId(Long articleId) {
		// TODO Auto-generated method stub
		 Map<String, Object> params = new HashMap<>();
		 params.put("1", articleId);
		return amdao.find("from ArticleCommet where articleid = ?1", params);
	}

	@Override
	public void addArticleCommet(ArticleCommet articleCommet) {
		// TODO Auto-generated method stub
		amdao.save(articleCommet);
	}

	@Override
	public List<ArticleCommet> getArticleCommetListByuserId(Long userid) {
		// TODO Auto-generated method stub
		Map<String, Object> params = new HashMap<>();
		 params.put("1", userid);
		return amdao.find("from ArticleCommet where userid = ?1", params);
	}

	@Override
	public ArticleCommet getArticleCommetById(Long id) {
		// TODO Auto-generated method stub
		return amdao.get(ArticleCommet.class, id);
	}

	@Override
	public void deleteArticleCommet(ArticleCommet a) {
		// TODO Auto-generated method stub
		amdao.delete(a);
	}

}
